package com.molichuxing.services.infrastructure.service;

import java.util.List;
import java.util.Map;

import com.molichuxing.framework.dto.Paged;
import com.molichuxing.framework.service.RootService;
import com.molichuxing.services.infrastructure.dto.request.create.DealerCreateDto;
import com.molichuxing.services.infrastructure.dto.request.modify.DealerModifyDto;
import com.molichuxing.services.infrastructure.dto.response.DealerDto;

/**
 * <p>
 * 经销商基础信息 服务类
 * </p>
 *
 * @author
 * @since 2019-08-12
 */
public interface DealerService extends RootService {


    /**
     * 获取经销商基础信息分页列表
     *
     * @param map      key:status Integer 营业状态
     *                 key:shortName String 经销商名称
     *                 key：regionId Integer 区域ID
     *                 key:startCreateTime LocalDateTime 创建开始时间
     *                 key:endCreateTime LocalDateTime 创建结束时间
     * @param pageNum
     * @param pageSize
     * @return
     */
    Paged<DealerDto> getDealerPage(Map<String, Object> map, Integer pageNum, Integer pageSize) throws Exception;

    /**
     * 经销商添加
     *
     * @param dealerCreateDto
     * @return
     */
    Integer createDealer(DealerCreateDto dealerCreateDto) throws Exception;

    /**
     * 经销商修改
     *
     * @param dealerModifyDto
     * @return
     */
    Boolean modifyDealer(DealerModifyDto dealerModifyDto) throws Exception;


    /**
     * 编辑经销商状态
     *
     * @param dealerId
     * @param status
     * @return
     * @throws Exception
     */
    Boolean modifyDealerStatus(Integer dealerId, Integer status) throws Exception;

    /**
     * 获取经销商基础信息
     *
     * @param dealerId
     * @return
     * @throws Exception
     */
    DealerDto getDealerById(Integer dealerId) throws Exception;

    /**
     * 根据状态获取经销商数量
     *
     * @return
     * @throws Exception
     */
    Map<Integer, Integer> getDealerCountByStatus() throws Exception;

    /**
     * 通过id获取经销商map集合
     *
     * @param ids
     * @return
     * @throws Exception
     */
    Map<Integer, DealerDto> getDealerMapByIds(List<Integer> ids) throws Exception;

    /**
     * 通过id获取经销商集合
     *
     * @param ids
     * @return
     */
    List<DealerDto> getDealerDtoListByIds(List<Integer> ids);

    /**
     * 通过区域id查询经销商信息（营业中）
     *
     * @param regionIdList
     * @param dealerName
     * @return
     * @throws Exception
     */
    List<DealerDto> getDealerByRegionId(List<Integer> regionIdList, String dealerName);

    /**
     * 获取经销商list集合
     *
     * @return
     * @throws Exception
     */
    List<DealerDto> getAllDealerList(Integer status, Integer type, Integer dealerId) throws Exception;

    /**
     * 获取经销商list信息
     *
     * @return
     * @throws Exception
     */
    List<DealerDto> getDealerList() throws Exception;

    /**
     * 根据经销商名称模糊查询(营业中，分销)
     *
     * @param dealerName
     * @return
     */
    List<DealerDto> getDealerListByName(String dealerName);

    /**
     * 根据经销商名称模糊查询
     *
     * @param dealerName
     * @return
     */
    List<DealerDto> getAllDealerListByName(String dealerName);

    /**
     * 查询经销商名称是否存在
     *
     * @param shortName
     * @return
     */
    Boolean getShortNameExist(String shortName);

    /**
     * 查询经销商全称是否存在
     *
     * @param fullName
     * @return
     */
    Boolean getFullNameExist(String fullName);

    Integer getCount();

    /**
     * 获取所有经销商所在城市id
     *
     * @return
     */
    public List<Integer> getRegionId();

    /**
     * 根据区域id查询
     *
     * @param regionId 区域id
     * @return
     */
    public List<DealerDto> getDealerByRegionId(Integer regionId);

    /**
     * 根据区域id查询
     *
     * @param regionIds 区域id
     * @return
     */
    public List<DealerDto> getDealerByRegionId(List<Integer> regionIds);

    /**
     * 根据条件查询符合条件的数据
     *
     * @param param
     * @return
     */
    public List<DealerDto> getDealerListByParam(Map<String, Object> param);

    /**
     * 查询营业中的经销商数量
     *
     * @return
     */
    public Integer getOpenDealerCount();

    /**
     * 经销商模糊查询
     *
     * @param dealerName
     * @param status
     * @param type
     * @return
     */
    public List<DealerDto> getDealerByShortNameFuzzy(String dealerName, Integer status, Integer type);

}
